package es.ats.codington.festival.mappers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import es.ats.codington.festival.domain.Visitor;

/**
 * 
 * @author Codington_RED
 *
 */

public class VisitorMapper implements RowMapper<Visitor>{

	/**
	 * @param resultSet
	 * @param numRow
	 * @return visitor
	 * @throws SQLException
	 */
	@Override
	public Visitor mapRow(ResultSet resultSet, int numRow) throws SQLException {
		Visitor visitor = new Visitor();
		
		visitor.setVisitorId(resultSet.getInt("idVisitor"));
		visitor.setUserName(resultSet.getString("userName"));
		visitor.setPassword(resultSet.getString("password"));
		visitor.setAdmin(resultSet.getBoolean("admin"));
		
		return visitor;
	}

}
